package cn.itsub.javablog.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 夏增明
 * @Date: 2021/06/18/18:02
 * @Description:
 */
@Component
public class BaseInterceptor implements HandlerInterceptor {
    /**
     * 配置在 cn.itsub.javablog.config.WebCongig
     * 执行顺序: preHandle -> controller -> postHandle -> 视图渲染 -> afterCompletion
     */


    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        // TODO Auto-generated method stub
        return true; //返回true代表放行
    }


    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
                           ModelAndView modelAndView) throws Exception {
        // TODO Auto-generated method stub

    }


    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
            throws Exception {
        // TODO Auto-generated method stub
    }

}
